﻿using System;
using System.Web.Mvc;
using Citi.Scheduler.Domain;
using Citi.Scheduler.WebUi.Models;

namespace Citi.Scheduler.WebUi.Controllers
{
    public class RoutineOnDemandController : ControllerBase<RoutineOnDemandModel, RoutineOnDemand>
    {
        public virtual ActionResult Create(int routineId)
        {
            var model = new RoutineOnDemandModel { Date = DateTime.Now, RequesterId = ((Citi.Scheduler.Domain.User)Session["LoggedUser"]).Id, RoutineId = routineId};

            var action = CreateBase(model);
            new RoutineSchedule().SendOnDemandRoutines();

            return action;
        }
    }
}
